package behavior.observer;

/**
 * @author dali
 * @date 2021-07-26 16:27
 * @Description
 */

public class Client {
    public static void main(String[] args) {
        //创建目标对象
        Subject concreteSubject = new ConcreteSubject();
        //创建观察者
        Observer o1 = new ConcreteObserver1();
        Observer o2 = new ConcreteObserver2();
        //将目标对象与观察者关联
        concreteSubject.addObserver(o1);
        concreteSubject.addObserver(o2);
        //目标对象发生变化
        concreteSubject.notifyObserver();
    }
}
